package com.zhxymm.book;

import com.zhxymm.book.dao.NewBookRepository;
import com.zhxymm.book.entity.NewBook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class BookApplication {

	@Autowired
	NewBookRepository newBookRepository;

	public static void main(String[] args) {
		SpringApplication.run(BookApplication.class, args);
	}
//
//	@Bean
//	CommandLineRunner runner(){
//		return args -> {
//
//			NewBook new1 = new NewBook("西游记", "文学", "001");
//			NewBook new2 = new NewBook("三国演义", "文学", "002");
//			NewBook new3 = new NewBook("红楼梦", "文学", "003");
//
//			NewBook new4 = new NewBook("水浒传", "文学", "004");
//			NewBook new5 = new NewBook("斗破苍穹", "小说", "005");
//			NewBook new6 = new NewBook("斗罗大陆", "小说", "006");
//
//			NewBook new7 = new NewBook("凤囚凰", "小说", "007");
//			NewBook new8 = new NewBook("微微一笑很倾城", "小说", "008");
//			NewBook new9 = new NewBook("安徒生童话", "外国童话", "009");
//
//
//			// 保存图书到数据库中
//
//			newBookRepository.save(new1);
//			newBookRepository.save(new2);
//			newBookRepository.save(new3);
//			newBookRepository.save(new4);
//			newBookRepository.save(new5);
//			newBookRepository.save(new6);
//			newBookRepository.save(new7);
//			newBookRepository.save(new8);
//			newBookRepository.save(new9);
//		};
//
//	}

}
